/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package xp_lab3;

/**
 *
 * @author hanxiao
 */
public class Person {
    
    private String name;
    private int age;
    
    public Person(String name, int age){
        if(age>=0){
            this.name = name;
            this.age = age;
        }else{
            this.name=name;
            this.age=0;
        }        
    }
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the age
     */
    public int getAge() {
        return age;
    }

    /**
     * @param age the age to set
     */
    public void setAge(int age) {
        if(age>=0){
            this.age = age;
        }else{
            this.age=0;
        }
    }
    
    public String reverseName(String s){
        String str = "";
        for(int i=0; i<s.length(); i++){
            str = s.charAt(i) + str;
        }
        return str;
    }    
}
